$(function() {
			var $btns = $("#btnset").buttonset();

			var clearDataForm = function() {
				$("#formData").find("input,textarea").val("");
			};

			// 新增数据按钮
			$("#btnAddData").click(function() {
						// 模态对话框 width height 为设置大小
						swss.ui.modal("/swss/user/popedom_addInit.action", {
									title : "新增权限",
									width : 500,
									height : 440
								});
						return false;
					});

			$("#btnAddPopedom").click(function() {
						$("#formData").attr("action",
								"/swss/user/popedom_add.action");
						clearDataForm();
						$("#dialogAddData").dialog({
									title : "新增权限",
									resizable : false,
									modal : true,
									width : 500,
									height : 350,
									buttons : {
										'保存' : function() {
											$("#formData").submit();
										},
										'取消' : function() {
											$(this).dialog("close");
										}
									}
								});

						return false;
					});

			$("#btnDelPopedom").click(function() {
						swss.ui.confirm("确定要删除这些权限？", function() {
									$("#formDelPope").submit();
								});

						return false;
					});

			var temp = "";
			var ids = "";

			$("a[id^='btnModPope_']").click(function() {
				temp = $(this).attr("id").split("_");
				swss.ui
						.modal(	"/swss/user/popedom_saveInit.action?popedom.id="
										+ temp[1] + "&p2=" + temp[2] + "&p1="
										+ temp[3], {
									title : "修改权限",
									width : 500,
									height : 500
								});
				return false;
			}).showTip({
						time : 0,
						style : 'ui-state-highlight ui-corner-all show-tip',
						showFn : function(tip, obj) {
							var html = "<div class='title' >点击操作</div>";
							temp = "";
							temp = $(obj).attr("title");
							html += "<div>" + temp + "</div>";
							$(obj).attr("title", '');

							$(tip).html(html);
						},
						hideFn : function(tip, obj) {
							$(obj).attr("title", temp)
						}
					});

			function selectEvent(obj) {
				if ($(obj).attr("data-type") == "1"
						|| $(obj).attr("data-type") == "2") {
					if ($(obj).attr("checked")) {
						$("#box_" + $(obj).val()).find("input").attr("checked",
								true).unbind("click").bind("click", function() {
									return false;
								});
					} else {
						$("#box_" + $(obj).val()).find("input").attr("checked",
								false).unbind("click").bind("click",
								function() {
									selectEvent(this);
								});
					}
				}
			}

			$("input[name='popedomIds']").click(function() {

						selectEvent(this);
					});

		});